//
//  Letuostate.swift
//  letuofu
//
//  Created by WH-JS on 2019/11/21.
//  Copyright © 2019 WH-JS. All rights reserved.
// 静态公共方法

import UIKit

class Letuostate: NSObject {

    func isPassWordString(password : String) -> Bool {
        /// 正则规则字符串
        let pattern = "^[(A-Za-z)+\\d+.]{6,8}"
        /// 正则规则
        let regex = try? NSRegularExpression(pattern: pattern, options: [])
        /// 进行正则匹配
        if let results = regex?.matches(in: password, options: [], range: NSRange(location: 0, length: password.count)), results.count != 0 {
            print("密码正则成功")
            for result in results{
                let string = (password as NSString).substring(with: result.range)
                print("对应密码:",string)
            }
            return true
        }
        return false
    }
}
